﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Csharpbiancheng_ch14_process_example1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        //【实例 1】创建 Windows 应用程序，在 RichTextBox 控件中显示所有当前系统中正在运行的进程。
        private void button1_Click(object sender, EventArgs e)
        {
            Process[] processes = Process.GetProcesses();
            foreach (Process p in processes)
            {
                richTextBox2.Text = richTextBox2.Text + p.ProcessName + "\r\n";
            }
        }
    }
}
